package com.ap.core.dao;


/**
 * User: Ranjit.Singh
 * A read only generic DAO interface.
 *
 * @param <T> generic type of the domain entity
 * @param <U> generic type of the primary key for the entity
 */
public interface ReadOnlyGenericDao<T, U> {

    /**
     * Synchronize the persistence context to the underlying database.
     */
    void flush();

    /**
     * Clear the persistence context, causing all managed entities to become detached. Changes made to entities that have not been flushed to the database will not be persisted.
     */
    void clear();

    /**
     * Find by primary key.
     * 
     * @param primaryKey
     *            primary key
     * @return the found entity instance or null if the entity does not exist
     */
    T findById(final U primaryKey);

}